package com.wyx.interceptor;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
* 拦截器类
*/
@Component
public class CorsInterceptor implements HandlerInterceptor {
    //跨域拦截器  这个配置需要被 WebConfig  配置一下
    @Override
    public boolean preHandle(HttpServletRequest requst, HttpServletResponse response, Object Handler) {
        response.setHeader("Access-Control-Allow-Origin","*");
        return true;
    }
}